package hzau.controller;

import hzau.result.Result;
import hzau.utils.OssUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@CrossOrigin
@RestController
public class TestController {
    @Autowired
    OssUtils ossUtils;
@GetMapping("/hello")
    public String hello(){
    return "hello";
}

    @PostMapping("/upload")
    public Result upload(@RequestParam("file") MultipartFile image) throws Exception {

        String url = ossUtils.upload(image);
        return Result.success(url);
    }
}
